package peace.grapher
{
import flash.display.Shape;
/**
 * Сетка к координатной плоскости
 *  
 * @author peace
 * 
 */
public class Grid extends Shape
{
	/**
	 * 
	 */
	public var color:int;
	/**
	 * 
	 */
	public var lineThickness:int;
	/**
	 * 
	 * 
	 */	
	public function Grid (color:int = 0xcccccc, lineThickness:int = 1)
	{
		super();
		this.color = color;
		this.lineThickness = lineThickness;
	}
	/**
	 * 
	 * 
	 */	
	public function redraw (plane:CoordinatePlane):void
	{
		with (graphics)
		{
			clear();
			lineStyle(lineThickness, color, 1, true, "normal", "none");
		}
		
		var w:Number = plane.width;
		var h:Number = plane.height;

		var i:int;
		for each (i in plane.xAxis.bigmarks)
		{
			with(graphics)
			{
				moveTo (i, 0);
				lineTo(i, h);
			}
		}
		for each (i in plane.yAxis.bigmarks)
		{
			with(graphics)
			{
				moveTo (0, i);
				lineTo(w, i);
			}
		}
	}
	
}
}